<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>DarkPan - Bootstrap 5 Admin Template</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="" name="keywords">
    <meta content="" name="description">


    <link rel="preconnect" href="https://fonts.googleapis.com/">
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="">
    <link href="../static/css/css2.css" rel="stylesheet">

    <link href="../static/css/all.min.css" rel="stylesheet">
    <link href="../static/css/bootstrap-icons.css" rel="stylesheet">

    <link href="../static/css/owl.carousel.min.css" rel="stylesheet">
    <link href="../static/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet">

    <link href="../static/css/bootstrap.min.css" rel="stylesheet">

    <link href="../static/css/style.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid position-relative d-flex p-0">

    <div id="spinner"
         class="show bg-dark position-fixed translate-middle w-100 vh-100 top-50 start-50 d-flex align-items-center justify-content-center">
        <div class="spinner-border text-primary" style="width: 3rem; height: 3rem;" role="status">
            <span class="sr-only">加载中...</span>
        </div>
    </div>


    <div class="container-fluid">
        <div class="row h-100 align-items-center justify-content-center" style="min-height: 100vh;">
            <div class="col-12 col-sm-8 col-md-6 col-lg-5 col-xl-4">
                <div class="bg-secondary rounded p-4 p-sm-5 my-4 mx-3">
                    <div class="d-flex align-items-center justify-content-between mb-3">
                        <a href="/" class="">
                            <h3 class="text-primary"><i class="fa fa-user-edit me-2"></i>照片举证系统</h3>
                        </a>
                        <h3>登录</h3>
                    </div>
                    <div class="form-floating mb-3">
                        <input type="text" class="form-control" id="username" placeholder="账户">
                        <label for="username">账户</label>
                    </div>
                    <div class="form-floating mb-4">
                        <input type="password" class="form-control" id="password" placeholder="密码">
                        <label for="password">密码</label>
                    </div>
                    <div class="d-flex align-items-center justify-content-between mb-4">

                    </div>
                    <button type="button" class="btn btn-primary py-3 w-100 mb-4" id="login">登录</button>
                    <p class="text-center mb-0">没有账户？ <a href="/register">注册</a></p>
                </div>
            </div>
        </div>
    </div>

</div>

<script src="../static/js/jquery.min.js" type="text/javascript"></script>
<script src="../static/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="../static/js/chart.min.js" type="text/javascript"></script>
<script src="../static/js/easing.min.js" type="text/javascript"></script>
<script src="../static/js/waypoints.min.js" type="text/javascript"></script>
<script src="../static/js/owl.carousel.min.js" type="text/javascript"></script>
<script src="../static/js/moment.min.js" type="text/javascript"></script>
<script src="../static/js/moment-timezone.min.js" type="text/javascript"></script>
<script src="../static/js/tempusdominus-bootstrap-4.min.js" type="text/javascript"></script>

<script src="../static/js/main.js" type="text/javascript"></script>
<script src="../static/js/rocket-loader.min.js" defer=""></script>
</body>
</html>
<script>
    $(function () {
        $("#login").click(function () {
            var username = $("#username").val();
            var password = $("#password").val();
            if ("" == username || undefined == username) {
                alert("账户不能为空");
                return
            }
            if ("" == password || undefined == password) {
                alert("密码不能为空");
                return
            }
            $.ajax({
                type: 'GET',
                url: "/user/login_check",
                dataType: 'json', //服务端返回json格式的数据
                data: {'username': username, 'password': password},
                contentType: "application/json; charset=utf-8",
                success: function (data) { // 这里的data就是返回的json格式的数据
                    window.location.href = '/index'
                },
                error: function (xhr, type) {
                    alert("账户密码不正确！");
                }
            });

        })
    })
</script>